#ifndef _SHADER_HPP
#define _SHADER_HPP

#include "PhoenixInitializer.hpp"
#include "vec.hpp"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "Color.hpp"

#define GLSL_150(src) "#version 150 \n" #src
#define GLSL_330(src) "#version 330 \n" #src

namespace phx
{

typedef const char* ShaderCode;

class Shader
{
public:
	Shader();
	bool loadFromMemory(ShaderCode vertexShaderCode, ShaderCode fragmentShaderCode);
	void setValue(const char *uniformName, const glm::mat4 &matrix);
	void setValue(const char *uniformName, const glm::vec3 &vec);
	void setValue(const char *uniformName, const vec2f &vec);
	void setValue(const char *uniformName, GLint value);
	void setValue(const char *uniformName, const phx::Colorf &color);
	void setBufferObjectData(float *data, unsigned int size);
	void use();
	~Shader();
private:
	GLuint mVao, mVbo, mEbo;
	GLuint mVertexShader, mFragmentShader, mShaderProgram;
};

struct DefaultShader
{
public:
	static Shader sprite;
	static Shader renderTexture;
	static Shader rectangle;
	friend class RenderWindow;
private:
	DefaultShader();
};

}

#endif